<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>09循环列表渲染</title>
    <style>
        .redBorder{
            border-color: red;
            border-width: 1px;
            border-style: solid;
        }
    </style>
</head>
<body>
<div id="app">
    计算器：{{ counter }}<br>
    <ul>
        <li v-for="(item, index) in array">{{index}}: {{item.city}}-{{item.code}}</li>
    </ul>
    <ul>
        <li v-for="(value, key, index) in object">{{index}}-{{key}}: {{value}}</li>
    </ul>
    <ul>
        <!--v-for支持多代码块渲染-->
        <template v-for="(item, index) in array">
            <li>{{item.city}}</li>
            <li>{{item.code}}</li>
        </template>
    </ul>
    <!--会创建10个span元素-->
    <span v-for="n in 10">{{n}}</span>
    <!--v-if和v-for不推荐用于同一元素-->
    <template v-for="(item, index) in array">
        <li v-if="item.city != '上海'">{{index}}: {{item.city}}</li>
    </template>
</div>
<script src="../vue.global.3.0.5.js"></script>
<script>
    //声明一个选项对象
    const App={
        //初始数据
        data() {
            return {
                counter: 100,
                array: [{city:"北京", code:"101"},{city:"上海", code:"102"},{city:"广州", code:"103"}],
                object: {name:"蝈蝈", age:12, gender:"男"}
            }
        },
        methods: {
            
        },
        computed: {
            compClassName: {
                get() {
                    
                },
                set(value) {

                }
            }
        }
    }

    //全局API对象，创建应用对象返回(选项对象).挂载方法(DOM节点)
    const vm = Vue.createApp(App).mount("#app");
</script>
</body>
</html>